package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.User;
import service.UserService;

import java.util.List;


@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/show")
    public String show(){
        return "index";
    }

    @RequestMapping("/login")
    public String login(User user){
        boolean flag=userService.login(user);
        if(flag){
            return "index";
        } else {
            return "login";
        }

    }
    @RequestMapping("/list")
    public String findAll(){
        List<User> users=userService.findAll(null,0, 10);
        return "index";
    }
    @RequestMapping("/addUser")
    public String addUser(){
        return "index";
    }
    @RequestMapping("deleteUser")
    public String deleteUser(){
        return "index";
    }
    @RequestMapping("toUpdateUser")
    public String toUpdate(){
        return "index";
    }
}
